package com.baizhi.mapper;

import com.baizhi.entity.Category;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import javax.swing.*;
import java.util.List;

public interface CategoryMapper {
    @Insert("insert into t_category values(null,#{name},#{levels},#{parentId})")
    void addCategory(Category category);
    @Delete("delete from t_category where category_id=#{id}")
    void removeCategory(Integer id);
    @Update("update t_category set name=#{name},levels=#{levels},parent_id=#{parentId}" +
            "where category_id=#{categoryId}")
    void updateCategory(Category category);
    Category selectCategory(Integer id);
    List<Category> selectAll(@Param("pageNum")Integer pageNum,@Param("pageSize")Integer pageSize);
    List<Category> selectAllCategoryId();
    List<Category> selectLevel1();
    int selectAllParentId(Integer id);
    List<Category> selectLevel2();
    Category selectByName(String name);
    List<Category> selectChild();
    List<Category> selectByParentId(Integer id);
}
